<?php
/*
# ------------------------------------------------------------------------
# Templates for Joomla 1.6 / Joomla 1.7
# ------------------------------------------------------------------------
# Copyright (C) 2011 Jtemplate.ru. All Rights Reserved.
# @license - PHP files are GNU/GPL V2.
# Author: JTemplate.ru
# Websites:  http://www.jtemplate.ru 
# ---------  http://code.google.com/p/jtemplate/   
# ------------------------------------------------------------------------
*/
// No direct access.
defined('_JEXEC') or die;
// Note. It is important to remove spaces between elements.
$document 		=& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'modules/mod_jt_superfish_menu/css/superfish.css');
if ($jt_style_menu == 1) { $document->addStyleSheet(JURI::base() . 'modules/mod_jt_superfish_menu/css/superfish-vertical.css'); }
if ($jt_style_menu == 2) { $document->addStyleSheet(JURI::base() . 'modules/mod_jt_superfish_menu/css/superfish-navbar.css'); }
if ($jt_menu == 1) {	
	if ($jquery == 1) {	$document->addScript(JURI::base() . 'modules/mod_jt_superfish_menu/js/jquery-1.6.2.min.js'); }
	if ($jquery == 2) {	$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); }	
	if ($jquery == 3) {	$document->addScript(JURI::base() . 'modules/mod_jt_superfish_menu/js/jquery-1.6.4.min.js'); }
	if ($jquery == 4) {	$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'); }
	if ($jquery == 5) {	$document->addScript(JURI::base() . 'modules/mod_jt_superfish_menu/js/jquery-1.7.min.js'); }
	if ($jquery == 6) {	$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js'); }	
	$document->addScript(JURI::base() . 'modules/mod_jt_superfish_menu/js/hoverIntent.js'); 
	$document->addScript(JURI::base() . 'modules/mod_jt_superfish_menu/js/superfish.js'); 
}
?>
<ul class="jt-menu<?php echo $class_sfx;?>"<?php
	$tag = '';
	if ($params->get('tag_id')!=NULL) {
		$tag = $params->get('tag_id').'';
		echo ' id="'.$tag.'"';
	}
?>>
<?php
foreach ($list as $i => &$item) :
	$class = '';
	if ($item->id == $active_id) {
		$class .= 'current ';
	}

	if (	$item->type == 'alias' &&
			in_array($item->params->get('aliasoptions'),$path)
		||	in_array($item->id, $path)) {
	  $class .= 'active ';
	}
	if ($item->deeper) {
		$class .= 'deeper ';
	}
	
	if ($item->parent) {
		$class .= 'parent ';
	}

	if (!empty($class)) {
		$class = ' class="'.trim($class) .'"';
	}

	echo '<li id="item-'.$item->id.'"'.$class.'>';

	// Render the menu item.
	switch ($item->type) :
		case 'separator':
		case 'url':
		case 'component':
			require JModuleHelper::getLayoutPath('mod_jt_superfish_menu', 'default_'.$item->type);
			break;

		default:
			require JModuleHelper::getLayoutPath('mod_jt_superfish_menu', 'default_url');
			break;
	endswitch;

	// The next item is deeper.
	if ($item->deeper) {
		echo '<ul>';
	}
	// The next item is shallower.
	else if ($item->shallower) {
		echo '</li>';
		echo str_repeat('</ul></li>', $item->level_diff);
	}
	// The next item is on the same level.
	else {
		echo '</li>';
	}
endforeach;
?></ul>
<script type="text/javascript"> 
   jQuery.noConflict();
   jQuery(document).ready(function(){ 
        jQuery("ul.jt-menu").superfish({ 
            animation:  <?php echo $animation; ?>,
            delay:      <?php echo $delay; ?>,
			speed:      '<?php echo $speed; ?>',
            autoArrows: <?php echo $autoarrows ?> 
        }); 
    });  
</script>
<div style="display:none"><a href="http://jtemplate.ru" target="_blank">jtemplate.ru - free extensions for joomla</a></div>